04/11/2020

In all the three plots below we will use predefined datasets available. 3D-SCATTER PLOT Developing a 3D scatter plot using type=“scatter3d”

library(plotly)
## Warning: package 'plotly' was built under R version 4.0.3
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
temperature_is <-rnorm(90, mean=20, sd=5)
pressure_is <-rnorm(90)
dtime <- 1:90
plot_ly(x=temperature_is, y=pressure_is, z=dtime, type="scatter3d", mode="markers", color=temperature_is)
## Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.

3D SURFACE Haere I am going to try and create a 3D surface plot by using the type=“surface”

library(plotly)
terrain <- matrix(sort(rnorm(100*100)), nrow = 100, ncol = 100)
plot_ly(z=terrain, type="surface")

SCATTER GRAPH here we are creating a normal scatter plot

library(plotly)
plot_ly(x=time(airmiles), y=airmiles, type="scatter")
## No scatter mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plot.ly/r/reference/#scatter-mode